import * as actionTypes from "./constants";

const defaultstate = {
  moviedata: [],
  index:2
};

const reducer = (state = defaultstate, action) => {
  switch (action.type) {
    case actionTypes.CHANGE_MOVIEDATA:
      return { ...state, moviedata: action.data };
    case actionTypes.CHANGE_INDEX:
        return { ...state, index: action.data }
    default:
      return state;
  }
};

export default reducer;
